﻿public class BlockAstTree : LuaAstTree
{
    private List<LuaAstTree> _statements;
    public IList<LuaAstTree> Statements => _statements;
    public override void WriteTo(ICodeWriter writer)
    {
        for (int i = 0; i < _statements.Count; i++)
        {
            if (_statements.Count == i + 1)
                if (_statements[i] is RetAstTree rat && (rat.Results == null || rat.Results.Length == 0))
                    break;
            if (i > 0)
                writer.Line();
            _statements[i]?.WriteTo(writer);
        }
    }
    public BlockAstTree()
    {
        _statements = new List<LuaAstTree>();
    }
}
